package io.renren.modules.eas.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.eas.entity.EasBasicStuEntity;
import io.renren.modules.eas.service.EasBasicStuService;



/**
 * 学生表
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2023-09-26 23:32:06
 */
@RestController
@RequestMapping("eas/easbasicstu")
public class EasBasicStuController {
    @Autowired
    private EasBasicStuService easBasicStuService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("eas:easbasicstu:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = easBasicStuService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
//    @RequiresPermissions("eas:easbasicstu:info")
    public R info(@PathVariable("id") Long id){
		EasBasicStuEntity easBasicStu = easBasicStuService.getById(id);

        return R.ok().put("easBasicStu", easBasicStu);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("eas:easbasicstu:save")
    public R save(@RequestBody EasBasicStuEntity easBasicStu){
		easBasicStuService.save(easBasicStu);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("eas:easbasicstu:update")
    public R update(@RequestBody EasBasicStuEntity easBasicStu){
		easBasicStuService.updateById(easBasicStu);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("eas:easbasicstu:delete")
    public R delete(@RequestBody Long[] ids){
		easBasicStuService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
